@extends('home.layoutedDetail')
@section('content')

<div class="hr-10"></div>
<div class="g">
    <!--面包屑 -->
<div class="breadcrumb-area"><a href="" title="首页">首页</a>&nbsp;&nbsp;\&nbsp;&nbsp;<em id="personCenter"><a href="/member/" title="我的商城">我的商城</a></em><em id="pathPoint">&nbsp;&nbsp;\&nbsp;&nbsp;</em><span id="pathTitle"></span></div>
</div>
<div class="hr-10"></div>

<div class="g">
    <div class="fr u-4-5"><!-- 20141212-栏目-start -->
<div class="section-header">
    <div class="fl">
        <h2><span>收货地址管理</span></h2>
    </div>
</div><!-- 20141212-栏目-end -->
<div class="hr-20"></div>
<!-- 20141216-我的收货地址-表单-编辑地址-start -->
<div class="myAddress-edit" id="myAddress-edit">
    <div class="form-edit-panels" id="form-edit-panels">
        @if(isset($edit))
        <form action="{{ url('/home/address/update') }}" method="post" >
        {{ csrf_field() }}
            <input type="hidden" name="uid" id="id" value="{{ session('user') -> id }}">
            <input type="hidden" name="id" id="id" value="{{ $res -> id }}">
            <div class="form-edit-table">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tbody>
                        <tr>
                            <th><span class="required">*</span><label for="consignee">收货人：</label></th>
                            <td>
                                <input maxlength="20" type="text" name="recname" value = "{{ $res -> recname }}" id="consignee" class="text span-130"/>
                                <label id="consignee-msg"></label>
                            </td>
                        </tr>
                        <tr>
                            <th rowspan="2" class="selecte-vat"><span class="required">*</span><label for="province">收货地址：</label></th>
                            <td>
                                <div id="city_4">
                                    <select name = "p" value = "{{ $res -> p }}" class="prov" style="height:40px;"></select>
                                    <select name = "c" value = "{{ $res -> c }}" class="city"  style="height:40px;" disabled="disabled"></select>
                                    <select name = "a" value = "{{ $res -> a }}" class="dist"  style="height:40px;" disabled="disabled"></select>
                                </div>
                            </td>
                        </tr>
                        <tr class="tr-rel">
                            <td>
                                <div class="inline-block relative">
                                    <textarea name="address" id="address" maxlength="100" class="textarea span-480">{{ $res -> address }}</textarea>
                                </div>
                                <label class="vat" id="address-msg"></label>
                            </td>
                        </tr>
                        <tr>
                            <th><label for="zipCode-add">邮编：</label></th>
                            <td>
                                <input maxlength="6" value = "{{ $res -> postcode }}" type="text" class="text span-80 ime-disabled" name="postcode" id="zipCode" />
                                <label id="zipCode-msg"></label>
                            </td>
                        </tr>
                        <tr>
                            <th><span class="required">*</span><label for="mobile">手机号码：</label></th>
                            <td>
                                <div class="inline-block vam">
                                    <input maxlength="15" type="text" name="phone" value = "{{ $res -> phone }}" id="mobile" class="text span-130 ime-disabled" alt="tel-msg"/><label class="titlebox" for="phone">
                                <div><label id="tel-msg"></label></div>
                            </td>
                        </tr>
                        <tr>
                            <th>&nbsp;</th>
                            <td>
                                <label class="inputbox"><input type="checkbox" class="checkbox" name="selected" value="1" id="myAddress-default"/><span>设为默认收货地址</span></label>
                            </td>
                        </tr>
        @else
        <form action="{{ url('/home/address/insert') }}" method="post" >

        {{ csrf_field() }}
            <input type="hidden" name="uid" id="id" value="{{ session('user') -> id }}">
            <div class="form-edit-table">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tbody>
                        <tr>
                            <th><span class="required">*</span><label for="consignee">收货人：</label></th>
                            <td>
                                <input maxlength="20" type="text" name="recname" id="consignee" class="text span-130"/>
                                <label id="consignee-msg"></label>
                            </td>
                        </tr>
                        <tr>
                            <th rowspan="2" class="selecte-vat"><span class="required">*</span><label for="province">收货地址：</label></th>
                            <td>
                                <div id="city_4">
                                    <select name = "p" class="prov" style="height:40px;"></select>
                                    <select name = "c" class="city"  style="height:40px;" disabled="disabled"></select>
                                    <select name = "a" class="dist"  style="height:40px;" disabled="disabled"></select>
                                </div>
                            </td>
                        </tr>
                        <tr class="tr-rel">
                            <td>
                                <div class="inline-block relative">
                                    <textarea name="address" id="address" maxlength="100" class="textarea span-480"></textarea>
                                </div>
                                <label class="vat" id="address-msg"></label>
                            </td>
                        </tr>
                        <tr>
                            <th><label for="zipCode-add">邮编：</label></th>
                            <td>
                                <input maxlength="6" type="text" class="text span-80 ime-disabled" name="postcode" id="zipCode" />
                                <label id="zipCode-msg"></label>
                            </td>
                        </tr>
                        <tr>
                            <th><span class="required">*</span><label for="mobile">手机号码：</label></th>
                            <td>
                                <div class="inline-block vam">
                                    <input maxlength="15" type="text" name="phone" id="mobile" class="text span-130 ime-disabled" alt="tel-msg"/><label class="titlebox" for="phone">
                                <div><label id="tel-msg"></label></div>
                            </td>
                        </tr>
                        <tr>
                            <th>&nbsp;</th>
                            <td>
                                <label class="inputbox"><input type="checkbox" class="checkbox" name="selected" value="1" id="myAddress-default"/><span>设为默认收货地址</span></label>
                            </td>
                        </tr>
        @endif
                        <tr class="tr-action">
                            <th>&nbsp;</th>
                            <td>
                                <div id="form-edit-button">
                                    @if(isset($edit))
                                    <input type="submit" id="button-ok" class="button-action-ok" value="修改地址"/>
                                    @else
                                    <input type="submit" id="button-ok" class="button-action-ok" value="添加新地址"/>
                                    @endif
                                    <input type = "reset" value = "清&nbsp;&nbsp;空" id="button-cancel" class="button-action-cancel" onclick="ec.member.myAddress.reset()"><span></span>
                                    <label class="label-info" id="submit-msg"></label>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </form>
    </div>
</div>
<!-- 20141216-我的收货地址-表单-编辑地址-end -->
<div class="hr-30"></div>
<!-- 20141216-我的收货地址-列表-start -->
<!--表单-我的收货地址 -->
<div class="myAddress-record hide" id="myAddress-record" style="display: block;">
    <div class="list-group-title">
        <table cellspacing="0" cellpadding="0" border="0">
            <thead>
                <tr>
                    <th class="col-name">收货人</th>
                    <th class="col-address">收货地址</th>
                    <th class="col-zip">邮编</th>
                    <th class="col-tel">手机/电话</th>
                    <th class="col-operate">操作</th>
                </tr>
            </thead>
        </table>
    </div>
    @foreach($data as $k => $v)
    <div class="list-group" id="list-group">
        <div class="list-group-item" id="myAddress-area-37985455">
            <table cellspacing="0" cellpadding="0" border="0">
                <tbody>
                <tr>
                    <td class="col-name">{{ $v -> recname }}</td>
                    <td class="col-address">{{ $v -> address }}</td>
                    <td class="col-zip">{{ $v -> postcode }}</td>
                    <td class="col-tel"><p>{{ $v -> phone }}</p></td>
                    <td class="col-operate">
                        <p class="p-edit"><a class="edit" href="{{ asset('/home/address/edit') }}/{{ $v -> id }}" onclick="ec.member.myAddress.edit(37985455);" title="编辑"><span>编辑</span></a></p>
                        <p class="p-del"><a class="del" href="{{ asset('/home/address/delete') }}/{{ $v -> id }}" onclick="ec.member.myAddress.del(this,37985455);" title="删除"><span>删除</span></a></p>
                        @if($v -> selected == 1)
                        <p class="p-state"><span class="default">默认地址</span></p>
                        @elseif($v -> selected == 0)
                        <p class="p-state"><a class="set " href="{{ asset('/home/address/selected') }}/{{ $v -> id }}" onclick="ec.member.myAddress.setDefault(38353677)" title="设为默认收货地址"><span>设为默认</span></a></p>
                        @endif

                    </td>
                </tr>
            </table>
        </div>
    </div>
    @endforeach
</div>
<textarea class="hide" id="success-tips">
    <!-- 20141219-我的地址-编辑成功-start -->
    <div class="box-prompt-success-area">
        <div class="h">
            <i></i>
        </div>
        <div class="b">
            <p></p>
        </div>
    </div>
</textarea>
<script src="{{ url('/ho/js/address.min.js') }}"></script></div>
    <div class="fl u-1-5">


<!--左边菜单 -->
<div class="mc-menu-area">
    <div class="h"><a href="/member?t=1480312721267" class="button-go-mc" title="我的商城"><span>我的商城</span></a></div>
    <div class="b">
        <ul>
            <li>
                <h3>
                    <span>订单中心</span>
                </h3>
                <ol>
                    <li id="li-order"><a href="/member/order?t=1480312721267" title="我的订单"><span>我的订单<em>0</em></span></a></li>
                    <li id="li-exchange"><a href="/member/exchange?t=1480312721267" title="我的退换货"><span>我的退换货</span></a></li>
                    <li id="li-groupBuyRecord"><a href="/member/groupBuyRecord?t=1480312721267" title="我的团购"><span>我的团购</span></a></li>
                    <li id="li-recover"><a href="/member/recycle/index?t=1480312721267" title="我的回收单"><span>我的回收单</span></a></li>
                </ol>
            </li>
            <li>
                <h3>
                    <span>个人中心</span>
                </h3>
                <ol>
                    <li id="li-myAppointment"><a href="/member/myAppointment?t=1480312721267" title="我的预约"><span>我的预约</span></a></li>
                    <li id="li-notification"><a href="/member/notification?t=1480312721267" title="到货通知"><span>到货通知</span></a></li>
                    <li id="li-point"><a href="/member/point?t=1480312721267" title="等级与特权"><span>等级与特权</span></a></li>
                    <li id="li-newpoint"><a href="/member/newpoint?t=1480312721267" title="我的积分"><span>我的积分</span></a></li>
                    <li id="li-zhima"><a href="/member/zm?t=1480312721267" title="芝麻信用"><span>芝麻信用</span></a></li>
                    <li id="li-authentication"><a href="/authmember/accesstoken?t=1480312721267" title="实名认证"><span>实名认证</span></a></li>
                    <li id="li-balance"><a href="/member/balance?t=1480312721267" title="代金券"><span>代金券</span></a></li>
                    <li id="li-petal"><a href="/member/petal?t=1480312721267" title="我的花瓣"><span>我的花瓣</span></a></li>
                    <li id="li-coupon"><a href="/member/coupon?t=1480312721267" title="我的优惠劵"><span>我的优惠劵</span></a></li>
                    <li id="li-enterprise" class="hide"></li>
                    <li id="li-myAddress"><a href="/member/myAddress?t=1480312721267" title="收货地址管理"><span>收货地址管理</span></a></li>
                    <!--
                    <li id="li-zp"><a href="/member/invoiceQualifications/view?t=1480312721267" title="专票资质"><span>专票资质</span></a></li>
                    -->
                </ol>
            </li>
            <li>
                <h3>
                    <span>社区中心</span>
                </h3>
                <ol>
                    <li id="li-prdRemark"><a href="/member/prdRemarkView?t=1480312721267" title="商品评价"><span>商品评价</span></a></li>
                    <li id="li-msg"><a href="/member/msg?t=1480312721267" title="站内信"><span>站内信</span></a></li>
                </ol>
            </li>
        </ul>
    </div>
    <div class="f"></div>
</div>
    </div>
</div>
<div class="hr-80"></div>
<script type="text/javascript" src="{{ asset('ho/jss/jquery.js') }}"></script>
<script type="text/javascript" src="{{ asset('ho/js/jquery.cityselect.js') }}"></script>
        <script type="text/javascript">
        window.onload = function(){
            $(function() {
                $("#city_4").citySelect({
                    prov: "江苏",
                    city: "南京",
                    dist: "玄武区南京",
                    nodata: "none"
                });
            });
        }

        </script>

@endsection
